#!/usr/bin/perl

use DB_File;
use Fcntl;
use Sys::Hostname;


tie (%control, 'DB_File', "/export/scripts/dynect-quebec/control.dbm", O_CREAT|O_RDWR, 0644) || die $!;

=cut
foreach $user (@lines) {
        #print "Verificando: $user...";
        if (exists $mydbm{$user}) {
                #print "User ja existe\n";
                #print "$user";

        }
        else
        {
                #print "Adicionando\n";
                $mydbm{$user} = $now;
                print "$user";
        }

        #print "user: $user\n";

}
=cut
        while ( ($k,$v) = each %control ) {
	#print "Linha:$k => $v\n";
		if ($v eq "up"){
			print "up = Linha:$k => $v\n";
			system("/export/scripts/send_quebec_gw.pl --service $k   --item probe_dynect   --monitor probe_up --value 1  --status 0");
		}
		if ($v eq "down"){
			print "down = Linha:$k => $v\n";
			system("/export/scripts/send_quebec_gw.pl --service $k   --item probe_dynect  --monitor probe_up --value \"$k =>$v\"  --match false --status 2");
		}
        }


=cut

[root@a4-zalta1 dynect-quebec]# /export/scripts/send_quebec_gw.pl

Usage: /export/scripts/send_quebec_gw.pl --service <servico> --item <item> --monitor <monitor> --value <valor> [--match true|false] [--status 0|1|2|3] [--verbose]
/export/scripts/send_quebec_gw.pl --service dynect  --item probe_dynect  --monitor probe_up --value 1 #ok 
/export/scripts/send_quebec_gw.pl --service tst.ipv6uol.com.br:EWR:200.147.97.168  --item probe_dynect  --monitor probe_up --value 1 #ok 
/export/scripts/send_quebec_gw.pl --service tst.ipv6uol.com.br:EWR:200.147.97.168  --item probe_dynect  --monitor probe_up --value "tst.ipv6uol.com.br:EWR:200.147.97.168 DOWN"  --match false --status 2
/export/scripts/send_quebec_gw.pl --service dynect  --item probe_dynect  --monitor probe_up --value "Host Key 0 --match false --status 2 

Defaults:
        match => true
        status => 0
        verbose is disabled



untie %control;


/export/scripts
[root@a4-zalta1 scripts]# ./send_quebec_gw.pl

